﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--body, html,#allmap {width: 100%;height: 100%;overflow: hidden;hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}-->

#bmap{ width:100%; height:100%; border:2px solid #FFC450; margin:10px auto; }
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.5&ak=F4856c3883499a59597ec1849504c3ac"></script>
<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
<title></title>
<Script language="javascript">

    function GetRequest() {

        var url = location.search; //获取url中"?"符后的字串

        var theRequest = new Object();

        if (url.indexOf("?") != -1) {

            var str = url.substr(1);

            strs = str.split("&");

            for (var i = 0; i < strs.length; i++) {

                theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);

            }

        }

        return theRequest;

    }

</Script>
<Script language="javascript">

    var Request = new Object();

    Request = GetRequest();

    var xx, yy;

    xx = Request['xx'];

    yy = Request['yy'];


</Script>
</head>
<body>

    <div id="bmap" ></div>


</body>
</html>

<script type="text/javascript">
    var gpsPoint;
    var map;
    function WriteMap(x, y) {
        map = new BMap.Map("bmap");
        gpsPoint = new BMap.Point(x, y);


        BMap.Convertor.translate(gpsPoint, 0, translateCallback);
    }
    translateCallback = function (point) {
        map.centerAndZoom(point, 14);
        var marker1 = new BMap.Marker(point);  // 创建标注
        map.addOverlay(marker1);              // 将标注添加到地图中

		var myGeo = new BMap.Geocoder();    
		// 根据坐标得到地址描述  
		myGeo.getLocation(point, function(result){    
		 if (result){    
		   
			//创建信息窗口
			var infoWindow1 = new BMap.InfoWindow("事故地点："+result.address);
			marker1.addEventListener("click", function () { this.openInfoWindow(infoWindow1); });
		 }    
		});  
        
    }
    WriteMap(xx, yy);
    

</script>
